package com.internship.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.internship.dao.EnterpriseInfoDao;
import com.internship.model.City;
import com.internship.model.EnterpriseInfo;
import com.internship.model.Province;
import com.internship.page.Page;

@Service
public class EnterpriseInfoService {
	private final int PAGE_SIZE = 10;
	@Autowired
	private EnterpriseInfoDao enterpriseinfoDao;

	public EnterpriseInfo getEnterpriseinfo(int Id) {
		return enterpriseinfoDao.getEnterpriseinfo(Id);
	}
	public Page<EnterpriseInfo> getEnterpriseinfoList(int TheProvince, int TheCity,String Name,int pageNumber) {
		Page<EnterpriseInfo> page = new Page<EnterpriseInfo>(pageNumber, PAGE_SIZE);
		List<EnterpriseInfo> list = enterpriseinfoDao.getEnterpriseinfoList(TheProvince, TheCity,Name, page);
		page.setResultList(list);
		return page;
	}
	public List<EnterpriseInfo> getEnterpriseList() {
		List<EnterpriseInfo> list = enterpriseinfoDao.getEnterpriseList();
		return list;
	}
	public int addEnterpriseinfo(EnterpriseInfo enterpriseinfo) {
		return enterpriseinfoDao.addEnterpriseinfo(enterpriseinfo);
	}
	public int updateEnterpriseinfo(EnterpriseInfo enterpriseinfo) {
		return enterpriseinfoDao.updateEnterpriseinfo(enterpriseinfo);
	}
	public int delEnterpriseinfo(int Id) {
		return enterpriseinfoDao.delEnterpriseinfo(Id);
		}
	public int delAll(String[] ids) {
		return enterpriseinfoDao.delAll(ids);
	}
	public List<Province> getProvince() {
		List<Province> list = enterpriseinfoDao.getProvince();
		return list;
	}
	public List<City> getCity(int ProvinceId) {
		List<City> list = enterpriseinfoDao.getCity(ProvinceId);
		return list;
	}
	public List<City> getCity() {
		List<City> list = enterpriseinfoDao.getCity();
		return list;
	}
	public List<EnterpriseInfo> getEnterpriseinfoEnterList(int TheProvince,int TheCity) {
		List<EnterpriseInfo> list = enterpriseinfoDao.getEnterpriseinfoEnterList(TheProvince, TheCity);
		return list;
	}
}
